
local cmdname = "aids_bantrain"

if CLIENT then

	local args = { { Name = "Kill Mode", Value = false },
	{ Name = "Ban Mode", Value = true } }

	AIDS.RegisterCommand( "Ban Train", cmdname, "bantrain", args ) 

else
	
	local function BantrainPlayer( ply, cmd, args )
	
		local target = AIDS.GetPlayer( args[1] )
		
		if target and ( ( !target:IsAdmin() and !target:IsSuperAdmin() ) or not tobool( args[2] ) ) then
		
			local train = ents.Create( "sent_bantrain" )
			train:SetPos( target:GetPos() + Vector( 5000, 0, 0 ) )
			train:SetAngles( ( target:GetPos() - train:GetPos() ):Normalize():Angle() )
			train:SetOwner( target )
			train:Spawn()
			
			local bool = tobool( args[2] )
			
			if bool then
			
				AIDS.ChatPrint( { "Choo choo! The ban train is coming to pick up ", target, "!" } )
				
				target:Ban( 0, "Permabanned by the Ban Train." )
				
			else
			
				train:SetKick( false )
			
				AIDS.ChatPrint( { "Choo choo! The pain train is coming to pick up ", target, "!" } )
			
			end
			
		end
	
	end
	
	AIDS.AddCommand( BantrainPlayer, cmdname )
	
end